package cate.common.game.trace.entity;

import cate.common.game.trace.GameTraceUtils;
import cate.common.game.trace.SQLiteHelper;
import cate.common.game.trace.SQLiteTextLength;
import easy.mysql.map.KeyType;
import easy.mysql.map.anno.MyColumn;
import easy.mysql.map.anno.MyTable;
import lombok.ToString;

import javax.persistence.GenerationType;
import java.util.Date;

@ToString
@MyTable(table = RoleTraceDailyLog.TABLE, generationType = GenerationType.AUTO, comment = "主角每日打点数据日志")
public class RoleTraceDailyLog {
    /** 存储表名 */
    public static final String TABLE = "role_trace_daily_log";
    @SQLiteTextLength(length = 64)
    @MyColumn(comment = "唯一ID", keyType = KeyType.PRIMARY)
    public String uid;
    @MyColumn(comment = "记录日期")
    public Date log_date;
    @SQLiteTextLength(length = 32)
    @MyColumn(comment = "角色ID")
    public String role_id;
    @SQLiteTextLength(length = 64)
    @MyColumn(comment = "账号ID")
    public String open_id;
    @SQLiteTextLength(length = 32)
    @MyColumn(comment = "客户端IP")
    public String client_ip;
    @SQLiteTextLength(length = 64)
    @MyColumn(comment = "设备ID")
    public String device_id;
    @SQLiteTextLength(length = 64)
    @MyColumn(comment = "客户端版本")
    public String client_version;
    @SQLiteTextLength(length = 64)
    @MyColumn(comment = "平台")
    public String platform;
    @MyColumn(comment = "注册时间")
    public Date register_time;
    @MyColumn(comment = "首次登录时间")
    public Date login_time;
    @MyColumn(comment = "离线时间")
    public Date logout_time;
    @MyColumn(comment = "服务器ID")
    public int server_id;
    @SQLiteTextLength(length = 32)
    @MyColumn(comment = "用户名")
    public String username;
    @MyColumn(comment = "当前等级")
    public int current_level;
    @MyColumn(comment = "战力")
    public long power;
    @MyColumn(comment = "登录次数")
    public int login_count;
    @MyColumn(comment = "在线时长")
    public long online_time;
    @MyColumn(comment = "连续登录天数")
    public int continuous_online_day;
    @MyColumn(comment = "首次充值时间")
    public Date first_pay_time;
    @MyColumn(comment = "最后充值时间")
    public Date last_pay_time;
    @MyColumn(comment = "总充值金额")
    public long total_pay_amount;
    @MyColumn(comment = "总充值次数")
    public int total_pay_num;
    @MyColumn(comment = "钻石存量")
    public long diamond;
    @MyColumn(comment = "金币存量")
    public long gold;
    @MyColumn(comment = "0-2点是否在线")
    public boolean online_0;
    @MyColumn(comment = "2-4点是否在线")
    public boolean online_1;
    @MyColumn(comment = "4-6点是否在线")
    public boolean online_2;
    @MyColumn(comment = "6-8点是否在线")
    public boolean online_3;
    @MyColumn(comment = "8-10点是否在线")
    public boolean online_4;
    @MyColumn(comment = "10-12点是否在线")
    public boolean online_5;
    @MyColumn(comment = "12-14点是否在线")
    public boolean online_6;
    @MyColumn(comment = "14-16点是否在线")
    public boolean online_7;
    @MyColumn(comment = "16-18点是否在线")
    public boolean online_8;
    @MyColumn(comment = "18-20点是否在线")
    public boolean online_9;
    @MyColumn(comment = "20-22点是否在线")
    public boolean online_10;
    @MyColumn(comment = "22-24点是否在线")
    public boolean online_11;
    @MyColumn(comment = "VIP等级")
    public int vip_level;
    @MyColumn(comment = "VIP经验")
    public long vip_exp;
    @MyColumn(comment = "首次充值金额")
    public long first_recharge_num;
    @MyColumn(comment = "首次充值类型")
    public int first_recharge_type;
    @MyColumn(comment = "当前月卡是否开启")
    public boolean current_month_pass;
    @MyColumn(comment = "当前引导进度")
    public int guide_id;
    @MyColumn(comment = "当前主线任务进度")
    public int main_task_id;
    @MyColumn(comment = "当前冒险进度")
    public int adventure_id;
    @MyColumn(comment = "当前冒险BOSS进度")
    public int adventure_boss_id;
    @MyColumn(comment = "当前爬塔进度")
    public int tower_id;
    @MyColumn(comment = "当前水族禁地进度")
    public int forbidden_1_id;
    @MyColumn(comment = "当前火族禁地进度")
    public int forbidden_2_id;
    @MyColumn(comment = "当前木族禁地进度")
    public int forbidden_3_id;
    @MyColumn(comment = "当前土族禁地进度")
    public int forbidden_4_id;
    @MyColumn(comment = "当前光族禁地进度")
    public int forbidden_5_id;
    @MyColumn(comment = "当前暗族禁地进度")
    public int forbidden_6_id;
    @MyColumn(comment = "当前金币副本进度")
    public int daily_fb_1_id;
    @MyColumn(comment = "金币副本挑战次数")
    public int daily_fb_1_count;
    @MyColumn(comment = "当前经验副本进度")
    public int daily_fb_2_id;
    @MyColumn(comment = "经验副本挑战次数")
    public int daily_fb_2_count;
    @MyColumn(comment = "当前英雄副本进度")
    public int daily_fb_3_id;
    @MyColumn(comment = "英雄副本挑战次数")
    public int daily_fb_3_count;
    @MyColumn(comment = "当前圣器副本进度")
    public int daily_fb_4_id;
    @MyColumn(comment = "圣器副本挑战次数")
    public int daily_fb_4_count;
    @MyColumn(comment = "当前徽章副本进度")
    public int daily_fb_5_id;
    @MyColumn(comment = "徽章副本挑战次数")
    public int daily_fb_5_count;
    @MyColumn(comment = "当前阵法副本进度")
    public int daily_fb_6_id;
    @MyColumn(comment = "阵法副本挑战次数")
    public int daily_fb_6_count;
    @MyColumn(comment = "当前铭文副本进度")
    public int daily_fb_7_id;
    @MyColumn(comment = "铭文副本挑战次数")
    public int daily_fb_7_count;
    @MyColumn(comment = "当前无尽试炼进度")
    public int endless_id;
    @MyColumn(comment = "无尽试炼挑战次数")
    public int endless_count;
    @MyColumn(comment = "当前d迷失神庙进度")
    public int island_id;
    @MyColumn(comment = "迷失神庙挑战次数")
    public int island_count;
    @MyColumn(comment = "好友数量")
    public int friend_num;
    @MyColumn(comment = "聊天次数")
    public int chat_count;
    @MyColumn(comment = "公会聊天次数")
    public int club_chat_count;
    @MyColumn(comment = "是否在公会内")
    public boolean in_club;
    @MyColumn(comment = "好友赠礼赠予次数")
    public int friend_gift_give_count;
    @MyColumn(comment = "好友赠礼领取次数")
    public int friend_gift_get_count;
    @MyColumn(comment = "积分赛排名")
    public int point_race_rank;
    @MyColumn(comment = "积分赛挑战次数")
    public int point_race_count;

    public static String initSql() {
        return GameTraceUtils.sql(TABLE);
    }

    public static void main(String[] args) {
        SQLiteHelper.generateSQLiteSQL(RoleTraceDailyLog.class);
    }

    /**
     * 在线小时
     */
    public void recordOnlineHour(int hour) {
        switch (hour) {
            case 0:
            case 1:
                online_0 = true;
                break;
            case 2:
            case 3:
                online_1 = true;
                break;
            case 4:
            case 5:
                online_2 = true;
                break;
            case 6:
            case 7:
                online_3 = true;
                break;
            case 8:
            case 9:
                online_4 = true;
                break;
            case 10:
            case 11:
                online_5 = true;
                break;
            case 12:
            case 13:
                online_6 = true;
                break;
            case 14:
            case 15:
                online_7 = true;
                break;
            case 16:
            case 17:
                online_8 = true;
                break;
            case 18:
            case 19:
                online_9 = true;
                break;
            case 20:
            case 21:
                online_10 = true;
                break;
            case 22:
            case 23:
                online_11 = true;
                break;
        }
    }

    /**
     * 挑战日常副本
     *
     * @param type 副本类型
     */
    public void addDailyFBCount(int type, int times) {
        switch (type) {
            case 1:
                daily_fb_1_count += times;
                break;
            case 2:
                daily_fb_2_count += times;
                break;
            case 3:
                daily_fb_3_count += times;
                break;
            case 4:
                daily_fb_4_count += times;
                break;
            case 5:
                daily_fb_5_count += times;
                break;
            case 6:
                daily_fb_6_count += times;
                break;
            case 7:
                daily_fb_7_count += times;
                break;
        }
    }
}
